﻿USE [MyTemplate]
GO
/****** Object:  StoredProcedure [dbo].[spInsertLinkTitle]    Script Date: 2013-08-29 오후 9:01:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO



ALTER PROCEDURE [dbo].[spInsertLinkTitle] 
	-- Add the parameters for the stored procedure here
	@ArticleNO nvarchar(50), @Link nvarchar(100), @Title nvarchar(100)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
Declare @articleCount int;

SELECT @articleCount = count(*)
  FROM [dbo].[tbArticles]
  where [ArticleNO] = @ArticleNO;

if @articleCount < 1
begin
   INSERT INTO [dbo].[tbArticles]
           ([Link]
           ,[Title],[ArticleNO])
     VALUES
           (@Link
           ,@Title,@ArticleNO)
end

END
